//
//  BBSelfViewController.m
//  BearSiX
//
//  Created by Tom on 16/3/25.
//  Copyright © 2016年 Tom. All rights reserved.
//

#import "BBSelfViewController.h"

@interface BBSelfViewController ()<UITableViewDataSource,UITableViewDelegate>
{
    NSArray *_dataArr;
    NSArray *_dataArr2;
}
@property(nonatomic,strong)UITableView *tableView;
@end

@implementation BBSelfViewController
-(UITableView *)tableView{

    if (!_tableView) {
        _tableView =[[UITableView alloc]initWithFrame:CGRectMake(0, 0, WINSIZEWIDTH, WINSIZEHEIGHT)];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        //_tableView.userInteractionEnabled=NO;
    }
    
    return _tableView;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    //UITableView *icontbv=[[UITableView alloc]initWithFrame:CGRectMake(0, 64, WINSIZEWIDTH, 100)];
    
    [self.view addSubview:self.tableView];
    
    _dataArr = @[@[@"头像"],
  @[@"所属店面",@"职工编号",@"所属部门",@"职位"],
  @[@"手机号"],
  @[@"工作类型",@"折扣"]];
    _dataArr2 = @[@[@""],
                 @[@"北京施华洛摄影广渠门店",@"A18800004569",@"工程部",@"工程师"],
                 @[@"15000001234"],
                 @[@"写后台程序代码",@"10"]];
    UIImageView *icon=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 50, 50)];
    [icon setImage:[UIImage imageNamed:@"image12"]];
    // Do any additional setup after loading the view.
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{

    return _dataArr.count;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

    return  ((NSArray *)_dataArr[section]).count;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return WINSIZEWIDTH/40;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = [[UITableViewCell alloc]initWithStyle:(UITableViewCellStyleValue1) reuseIdentifier:nil];
    cell.textLabel.text = _dataArr[indexPath.section][indexPath.row];
    cell.detailTextLabel.text= _dataArr2[indexPath.section][indexPath.row];
    UIImageView *icon=[[UIImageView alloc]initWithFrame:CGRectMake(WINSIZEWIDTH-100, 15, 50, 50)];
    [icon setImage:[UIImage imageNamed:@"image12"]];
    
    if (indexPath.row==0&&indexPath.section==0) {
       [cell addSubview:icon];
        cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
    }
    if (indexPath.section>0) {
        cell.userInteractionEnabled=NO;
    }
    return cell;
    
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row==0&&indexPath.section==0) {
        return 80;
    }
    return 50;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
